<template>
  <div>
    <div class="header">
      <img src="@/assets/images/return.png" class="header_img" @click="back"/>
      <div class="title">个人介绍</div>
      <div class="save" @click="saveBack">保存</div>
    </div>
    <div class="textContent">
      <text-area classProp="introduction" @sendVal="setValue" :defaultText="introduction"></text-area>
    </div>

  </div>
</template>
<script>
  import TextArea from './TextArea'

  export default {
    name: "Introduction",
    components: {
      TextArea
    },
    data() {
      return {
        data:{
          introduction:''
        }
      }
    },
    computed:{
      introduction(){
        return this.$store.state.introduction
      }
    },
    methods: {
      back() {
        this.$router.back();
      },
      setValue(introduction){
        this.data.introduction = introduction
      },
      saveBack(){
        this.$store.dispatch('action_updateIntroduction', this.data).then()
        this.$router.back();
      }
    },

  }
</script>

<style scoped>
  .header {
    box-sizing: border-box;
    position: relative;
    display: flex;
    height: 90px;
    background-color: #8ec43e;
    align-items: center;
    padding: 0 30px;
  }

  .header_img {
    width: 17px;
    height: 30px;
  }

  .title {
    text-align: center;
    flex: 1;
    font-size: 30px;
    color: #ffff;
  }

  .save {
    font-size: 28px;
    color: #ffffff;
  }

  .textContent {
    padding-top: 16px;
    display: flex;
    justify-content: center;
  }

  .introduction {
    width: 700px;
    padding: 16px;
    font-size: 28px;
    border-radius: 4px;
  }
</style>
